package ThreadApi;

public class Demo1 {
    public static void main(String[] args) {
        Thread t=new MyTread("MyThread1");
//        t.setName("MyThread1");
        t.start();
        System.out.println(t.getName());

        Thread t1=new MyTread("MyThread2");
        t1.start();
        System.out.println(t1.getName());
    }
}
class MyTread extends Thread{
    public MyTread(String name){
        super(name);
    }
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName()+"子线程："+i);
        }
    }
}
